from crontab import CronTab

demo_cron = CronTab(user=True)

demo_cron.remove_all(comment="update_time")
demo_cron.write()

demo_job = demo_cron.new(command='date >> ~/cron_demo.log', comment="update_time")
# auto update time at 1:00 am
demo_job.setall("*/1 * * * *")
demo_job.enable()
demo_cron.write()
